/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * DialogoPartidasIndividuales.java
 *
 * Created on 23/11/2012, 12:16:19 AM
 */
package gui;

import javax.swing.JLabel;
import javax.swing.table.DefaultTableCellRenderer;
import modelo.ModeloPartidasIndividuales;
import promesa.util.Constantes;

/**
 *
 * @author Administrador
 */
public class DialogoPartidasIndividuales extends javax.swing.JDialog {

    private ModeloPartidasIndividuales modeloPartidasIndividuales = new ModeloPartidasIndividuales();
    private boolean estaOculto = true;

    /** Creates new form DialogoPartidasIndividuales */
    public DialogoPartidasIndividuales(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        this.modeloPartidasIndividuales = new ModeloPartidasIndividuales();
        tblPartidasIndividuales.setModel(modeloPartidasIndividuales);
        tblPartidasIndividuales.getTableHeader().setReorderingAllowed(false);
        ((DefaultTableCellRenderer) tblPartidasIndividuales.getTableHeader().getDefaultRenderer()).setHorizontalAlignment(JLabel.CENTER);
        tblPartidasIndividuales.getTableHeader().setFont(Constantes.FUENTE_CABECERA_TABLA);
        this.setSize(800, 350);
        this.setLocationRelativeTo(null);
        pnlParametrosBusqueda.setVisible(false);
        btnGrpOpcionesBusqueda.add(rdbPartidasAbiertas);
        btnGrpOpcionesBusqueda.add(rdbPartidasCompensadas);
        btnGrpOpcionesBusqueda.add(rdbTodasPartidas);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        btnGrpOpcionesBusqueda = new javax.swing.ButtonGroup();
        pnlBusqueda = new javax.swing.JPanel();
        pnlParametrosBusqueda = new javax.swing.JPanel();
        rdbPartidasAbiertas = new javax.swing.JRadioButton();
        lblPartidasAbiertas = new javax.swing.JLabel();
        datePartidasAbiertas = new com.toedter.calendar.JDateChooser();
        rdbPartidasCompensadas = new javax.swing.JRadioButton();
        lblFechaClave = new javax.swing.JLabel();
        datePartidasCompensadas = new com.toedter.calendar.JDateChooser();
        rdbTodasPartidas = new javax.swing.JRadioButton();
        lblDesde = new javax.swing.JLabel();
        dateDesde = new com.toedter.calendar.JDateChooser();
        lblHasta = new javax.swing.JLabel();
        dateHasta = new com.toedter.calendar.JDateChooser();
        btnBuscar = new javax.swing.JButton();
        pbnlTitulo = new javax.swing.JPanel();
        lblOpcionesBusqueda = new javax.swing.JLabel();
        btnOcultar = new javax.swing.JButton();
        jSeparator2 = new javax.swing.JSeparator();
        pnlTabla = new javax.swing.JPanel();
        lblTitulo = new javax.swing.JLabel();
        scrPartidasIndividuales = new javax.swing.JScrollPane();
        tblPartidasIndividuales = new javax.swing.JTable();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle(".:: Partidas Individuales ::.");

        pnlBusqueda.setLayout(new java.awt.BorderLayout());

        pnlParametrosBusqueda.setPreferredSize(new java.awt.Dimension(400, 126));

        rdbPartidasAbiertas.setText("Partidas abiertas");
        rdbPartidasAbiertas.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);

        lblPartidasAbiertas.setText("Abiertas en la fecha clave:");

        rdbPartidasCompensadas.setText("Partidas compensadas");

        lblFechaClave.setText("Abiertas en la fecha clave:");

        rdbTodasPartidas.setText("Todas las partidas");

        lblDesde.setText("Desde:");

        lblHasta.setText("Hasta:");

        btnBuscar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/botonBuscar.jpg"))); // NOI18N
        btnBuscar.setBorder(null);
        btnBuscar.setBorderPainted(false);
        btnBuscar.setContentAreaFilled(false);
        btnBuscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBuscarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout pnlParametrosBusquedaLayout = new javax.swing.GroupLayout(pnlParametrosBusqueda);
        pnlParametrosBusqueda.setLayout(pnlParametrosBusquedaLayout);
        pnlParametrosBusquedaLayout.setHorizontalGroup(
            pnlParametrosBusquedaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlParametrosBusquedaLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlParametrosBusquedaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnBuscar)
                    .addComponent(rdbPartidasCompensadas)
                    .addComponent(rdbTodasPartidas, javax.swing.GroupLayout.DEFAULT_SIZE, 631, Short.MAX_VALUE)
                    .addGroup(pnlParametrosBusquedaLayout.createSequentialGroup()
                        .addComponent(lblDesde, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(dateDesde, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(lblHasta, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(dateHasta, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(pnlParametrosBusquedaLayout.createSequentialGroup()
                        .addGroup(pnlParametrosBusquedaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(rdbPartidasAbiertas, javax.swing.GroupLayout.DEFAULT_SIZE, 556, Short.MAX_VALUE)
                            .addGroup(pnlParametrosBusquedaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, pnlParametrosBusquedaLayout.createSequentialGroup()
                                    .addComponent(lblFechaClave)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(datePartidasCompensadas, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, pnlParametrosBusquedaLayout.createSequentialGroup()
                                    .addComponent(lblPartidasAbiertas)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(datePartidasAbiertas, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addGap(75, 75, 75)))
                .addContainerGap())
        );
        pnlParametrosBusquedaLayout.setVerticalGroup(
            pnlParametrosBusquedaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlParametrosBusquedaLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(rdbPartidasAbiertas, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlParametrosBusquedaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(datePartidasAbiertas, 0, 0, Short.MAX_VALUE)
                    .addComponent(lblPartidasAbiertas))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(rdbPartidasCompensadas, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlParametrosBusquedaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(datePartidasCompensadas, 0, 0, Short.MAX_VALUE)
                    .addComponent(lblFechaClave))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(rdbTodasPartidas, javax.swing.GroupLayout.PREFERRED_SIZE, 13, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlParametrosBusquedaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(dateHasta, javax.swing.GroupLayout.PREFERRED_SIZE, 14, Short.MAX_VALUE)
                    .addComponent(dateDesde, 0, 0, Short.MAX_VALUE)
                    .addComponent(lblDesde, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(lblHasta, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        pnlBusqueda.add(pnlParametrosBusqueda, java.awt.BorderLayout.CENTER);

        pbnlTitulo.setBorder(javax.swing.BorderFactory.createEmptyBorder(4, 4, 0, 4));
        pbnlTitulo.setLayout(new java.awt.BorderLayout());

        lblOpcionesBusqueda.setFont(new java.awt.Font("Tahoma", 1, 11));
        lblOpcionesBusqueda.setText("Opciones de búsqueda");
        pbnlTitulo.add(lblOpcionesBusqueda, java.awt.BorderLayout.CENTER);

        btnOcultar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/btnMaximizar.png"))); // NOI18N
        btnOcultar.setBorder(null);
        btnOcultar.setContentAreaFilled(false);
        btnOcultar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnOcultarActionPerformed(evt);
            }
        });
        pbnlTitulo.add(btnOcultar, java.awt.BorderLayout.LINE_END);

        jSeparator2.setBackground(new java.awt.Color(41, 101, 148));
        jSeparator2.setForeground(new java.awt.Color(41, 101, 148));
        jSeparator2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(41, 101, 148)));
        pbnlTitulo.add(jSeparator2, java.awt.BorderLayout.PAGE_END);

        pnlBusqueda.add(pbnlTitulo, java.awt.BorderLayout.PAGE_START);

        getContentPane().add(pnlBusqueda, java.awt.BorderLayout.PAGE_START);

        pnlTabla.setLayout(new java.awt.BorderLayout());

        lblTitulo.setFont(new java.awt.Font("Tahoma", 1, 11));
        lblTitulo.setText("Header");
        lblTitulo.setBorder(javax.swing.BorderFactory.createEmptyBorder(4, 4, 4, 1));
        pnlTabla.add(lblTitulo, java.awt.BorderLayout.PAGE_START);

        tblPartidasIndividuales.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        scrPartidasIndividuales.setViewportView(tblPartidasIndividuales);

        pnlTabla.add(scrPartidasIndividuales, java.awt.BorderLayout.CENTER);

        getContentPane().add(pnlTabla, java.awt.BorderLayout.CENTER);

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void btnOcultarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOcultarActionPerformed
// TODO add your handling code here:
    if(estaOculto) {
        btnOcultar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/btnOcultar.png"))); // NOI18N
    } else {
        btnOcultar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/btnMaximizar.png"))); // NOI18N
    }
    pnlParametrosBusqueda.setVisible(estaOculto);
    estaOculto = !estaOculto;
}//GEN-LAST:event_btnOcultarActionPerformed

private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_btnBuscarActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(DialogoPartidasIndividuales.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(DialogoPartidasIndividuales.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(DialogoPartidasIndividuales.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(DialogoPartidasIndividuales.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the dialog */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                DialogoPartidasIndividuales dialog = new DialogoPartidasIndividuales(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {

                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnBuscar;
    private javax.swing.ButtonGroup btnGrpOpcionesBusqueda;
    private javax.swing.JButton btnOcultar;
    private com.toedter.calendar.JDateChooser dateDesde;
    private com.toedter.calendar.JDateChooser dateHasta;
    private com.toedter.calendar.JDateChooser datePartidasAbiertas;
    private com.toedter.calendar.JDateChooser datePartidasCompensadas;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JLabel lblDesde;
    private javax.swing.JLabel lblFechaClave;
    private javax.swing.JLabel lblHasta;
    private javax.swing.JLabel lblOpcionesBusqueda;
    private javax.swing.JLabel lblPartidasAbiertas;
    private javax.swing.JLabel lblTitulo;
    private javax.swing.JPanel pbnlTitulo;
    private javax.swing.JPanel pnlBusqueda;
    private javax.swing.JPanel pnlParametrosBusqueda;
    private javax.swing.JPanel pnlTabla;
    private javax.swing.JRadioButton rdbPartidasAbiertas;
    private javax.swing.JRadioButton rdbPartidasCompensadas;
    private javax.swing.JRadioButton rdbTodasPartidas;
    private javax.swing.JScrollPane scrPartidasIndividuales;
    private javax.swing.JTable tblPartidasIndividuales;
    // End of variables declaration//GEN-END:variables
}
